/**
 * Alipay.com Inc.
 * Copyright (c) 2004-2013 All Rights Reserved.
 */
package com.pingan.mobilegw.core.service.util;

import com.alibaba.common.lang.StringUtil;

/**
 * 解析clientId
 * 
 * @author jinwenxiang
 * @version $Id: ClientIdUtil.java, v 0.1 2013-12-23 下午5:18:39 jinwenxiang Exp $
 */
public class ClientIdUtil {

    /**
     * 获取imsi
     * 
     * @param clientId
     * @return
     */
    public static String getImsi(String clientId) {
        if (StringUtil.isBlank(clientId)) {
            return null;
        }
        String[] strs = StringUtil.split(clientId, '|');
        if (strs == null || strs.length != 2) {
            return null;
        }
        return strs[0];
    }

    /**
     * 获取imei
     * 
     * @param clientId
     * @return
     */
    public static String getImei(String clientId) {
        if (StringUtil.isBlank(clientId)) {
            return null;
        }
        String[] strs = StringUtil.split(clientId, '|');
        if (strs == null || strs.length != 2) {
            return null;
        }
        return strs[1];
    }
}
